-
-
Notifications
You must be signed in to change notification settings - Fork 632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: added support for example short urls #3311
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Aakanksha <[email protected]>
WalkthroughThe changes made in the Changes
Suggested labels
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for asyncapi-website ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (2)
public/_redirects (2)
73-77
: LGTM! Consider adding a comment for clarity.The new short URL redirections are well-implemented and align with the PR objective. They provide a convenient way to access example AsyncAPI specifications.
Consider adding a brief comment above the SHORT-URL-REDIRECTION section to explain its purpose. For example:
+# Short URL redirections for quick access to AsyncAPI examples # SHORT-URL-REDIRECTION:START /s/example https://github.com/asyncapi/spec/blob/master/examples/streetlights-mqtt-asyncapi.yml 301! /s/* https://github.com/asyncapi/spec/blob/master/examples/:splat 301! # SHORT-URL-REDIRECTION:END
Potential Conflict with New
/s/*
RedirectionThe existing redirection
/s/example
may conflict with the new/s/*
wildcard rule.
public/_redirects
, Line:/s/example https://github.com/asyncapi/spec/blob/master/examples/streetlights-mqtt-asyncapi.yml 301!
🔗 Analysis chain
Line range hint
1-77
: Verify no conflicts with existing redirections.The placement of the new short URL redirections at the end of the file is correct. However, it's important to ensure that no existing redirections conflict with the new
/s/*
wildcard rule.Run the following script to check for potential conflicts:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for potential conflicts with the new /s/* redirection rule # Test: Search for any existing rules that might conflict with /s/* rg '^/s/' public/_redirects | grep -v '^/s/\*' # If the above command returns any results, it indicates a potential conflict # that needs to be addressed.Length of output: 149
⚡️ Lighthouse report for the changes in this PR:
Lighthouse ran on https://deploy-preview-3311--asyncapi-website.netlify.app/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
public/_redirects (1)
73-77
: LGTM! Consider placement of wildcard redirection.The addition of short URL redirections is well-implemented and aligns with the PR objective. The use of a comment block for easy identification is a good practice.
A minor suggestion:
Consider moving the wildcard redirection
/s/*
above the specific/s/example
redirection. This ensures that more specific rules take precedence over the wildcard rule, following the principle of most specific to least specific ordering in redirection rules.# SHORT-DOC-URL-REDIRECTION:START +/s/* https://github.com/asyncapi/spec/blob/master/examples/:splat 301! /s/example https://github.com/asyncapi/spec/blob/master/examples/streetlights-mqtt-asyncapi.yml 301! -/s/* https://github.com/asyncapi/spec/blob/master/examples/:splat 301! # SHORT-DOC-URL-REDIRECTION:ENDThis change would prevent any potential conflicts if more specific short URLs are added in the future.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- public/_redirects (1 hunks)
🧰 Additional context used
🔇 Additional comments (1)
public/_redirects (1)
Line range hint
1-77
: Overall, the changes look good and achieve the PR objective.The addition of short URL redirections for examples is well-implemented and doesn't interfere with existing redirections. The use of a comment block for easy identification is a good practice. With the minor suggestion for rule ordering, this implementation provides a solid foundation for managing example short URLs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
public/_redirects (1)
73-77
: LGTM! Consider optimizing rule order.The new redirection rules for short URLs are well-implemented:
- The wildcard rule
/s/*
provides a flexible way to access various examples.- The specific rule for
/s/example
offers a quick link to a common example.For optimal routing, consider swapping the order of these rules:
# SHORT-DOC-URL-REDIRECTION:START -/s/* https://github.com/asyncapi/spec/blob/master/examples/:splat 301! /s/example https://github.com/asyncapi/spec/blob/master/examples/streetlights-mqtt-asyncapi.yml 301! +/s/* https://github.com/asyncapi/spec/blob/master/examples/:splat 301! # SHORT-DOC-URL-REDIRECTION:ENDThis ensures the specific rule takes precedence over the wildcard rule, maintaining the intended behavior while potentially improving routing efficiency.
Description
Added support for example short urls
Related issue(s)
Summary by CodeRabbit
New Features
Bug Fixes